/**
 * Created by luodan on 2015/5/25 0025.
 */
define('nav', function() {
    return nav = avalon.define({
        $id: 'nav',
        isLogin: false,
        username: '',

        //退出登录
        outLogin: function(){
            $.call({
                i: '6',
                type: 'post',
                dataType: 'json',
                success: function(data){
                    if(data.c == 200){
                        nav.reLoad();
                        window.location.href = '#!/';
                        tip.on("已退出！",1,4000);
                    }
                    else{
                        tip.on(data.m,0,6000);
                    }
                }

            });
        },

        reLoad: function(){
            nav.isLogin = false;
            nav.username = '';
            setCookie('tsy','');
            setCookie('un','');
            setTsy();
        }
    });
});
